Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing provider config defaultTags #1393

Merged
merged 3 commits into from
Mar 11, 2024
Merged

Conversation

danielrbradley
Copy link
Member

@danielrbradley danielrbradley commented Mar 7, 2024

Fix the provider to parse the format as defined by the schema.

Keep a fallback in place to allow it parsing the default tags as a simple map for backward compatibility.

@danielrbradley danielrbradley requested review from thomas11 and a team March 7, 2024 09:36
@danielrbradley danielrbradley self-assigned this Mar 7, 2024
Copy link
Contributor

github-actions bot commented Mar 7, 2024

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 23.39%. Comparing base (b46b6fb) to head (e0c518b).
Report is 2 commits behind head on master.

Files Patch % Lines
provider/pkg/provider/provider.go 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1393      +/-   ##
==========================================
- Coverage   23.40%   23.39%   -0.01%     
==========================================
  Files          25       25              
  Lines        4230     4244      +14     
==========================================
+ Hits          990      993       +3     
- Misses       3077     3088      +11     
  Partials      163      163              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Make it align to what we parse in the provider - a string map, rather than an object with a "tags" property which is a string map.
@danielrbradley danielrbradley added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Mar 7, 2024
sdk/go/aws/provider.go Outdated Show resolved Hide resolved
@t0yv0
Copy link
Member

t0yv0 commented Mar 7, 2024

So this looks good provided you do want to take a breaking change here. One reason to think twice, I checked with TF they also have this structure:

			"default_tags": {
				Type:        schema.TypeList,
				Optional:    true,
				MaxItems:    1,
				Description: "Configuration block with settings to default resource tags across all resources.",
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"tags": {
							Type:        schema.TypeMap,
							Optional:    true,
							Elem:        &schema.Schema{Type: schema.TypeString},
							Description: "Resource tags to default across all resources",
						},
					},
				},
			},

I'm not sure but I think it's because there is some code around called TagIgnoreConfig and so forth, and possibly there were some plans to make the defaultTags do more than just add tags in the TF Provider but also have some sort of "policy" impact on transforming existing tags. Perhaps that's why this was modeled as a struct so new fields could have been added later. But they never were.

Perhaps in Pulumi the answer to this sort of thing is using transformations and it's never going to be needed anyway.

@t0yv0 t0yv0 self-requested a review March 7, 2024 19:08
@danielrbradley danielrbradley changed the title Fix provider config defaultTags schema Fix parsing provider config defaultTags Mar 8, 2024
- Allow the provider to parse both the old and new schemas for compatability.
- Switch to using an explicit provider to also ensure the schema is correct.
- Fix module name.
@danielrbradley danielrbradley enabled auto-merge (squash) March 11, 2024 10:54
@danielrbradley danielrbradley merged commit dce8812 into master Mar 11, 2024
17 checks passed
@danielrbradley danielrbradley deleted the default-tags-schema branch March 11, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants